import React from 'react';
import {gql, useMutation} from '@apollo/client';

const AddAccountGql = gql`
    mutation AddAccount($username: String!, $password: String!) {
        createAccount(username: $username, password: $password) {
            code
            message
        }
    }
`;

export const Page5: React.FC = () => {
    const [addTodo, {data}] = useMutation(AddAccountGql);
    console.log(data, '创建结果');
    const addAccountHandle = () => {
        addTodo({
            variables: {
                username: '王五12',
                password: '12345556',
            }
        })
    };
    return (
        <div>
            <h3>添加数据</h3>
            <button onClick={addAccountHandle}>添加数据</button>
        </div>
    )
}
